<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="socnet.controller.*" %>
<%@ page import="socnet.model.*" %>
<%@ page import="java.util.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<link href="./login.css" rel="stylesheet" type="text/css" />


<body>

<div class="container">
  <div class="header">
 <a href="http://localhost:8040/NKA-soc-net/myPage.jsp"><img src="images/profile.jpg" alt="Insert Logo Here" align="left" name="insert_logo" width="100" height="100" id="Insert_logo2" style="background-color: #8090AB; " /></a>
  <img src="images/GEEK_small.jpg" alt="Insert Logo Here" name="insert_logo" width="100" align="right" height="100" id="Insert_logo" style="background-color: #8090AB; display:block; "/><!-- end .header --></div>
 <br />
  <form id="form1" name="form1" method="post" action="" >
    <input type="text" name="search" id="search" />
    <input type="submit" name="searchB" id="searchB" value="Search" />
  </form>
  <br />
  <br />
  
  <div id="menu">
		<ul>
			<li><a href="groups.jsp" class="link">Groups</a></li>
			<li><a href="messages.jsp" class="link">Messages</a></li>
			<li><a href="myContacts.jsp" class="link">Contacts</a></li>
            <li><a href="myPictures.jsp" class="link">Pictures</a></li>
		</ul>
  </div>

  <%
  	String name="Bata András ", birthDay ="1990/07/08 ",gender= "M ", relation = "N "
  	, languages = "Hungary ",email = " ", mobile = "3026xxxx4 ", workName= "Demo ", workstart = "2012 ", workend= "2013 ";
  
//  	email = session.getAttribute("email").toString();
	email = "bata.andras@gmail.com";
  	SocnetController socnet = new SocnetController();
  	socnet.startDB();
  	List<User> users = socnet.getUser(email,1);
  	socnet.stopDB();
  	Iterator<User> it = users.iterator();
  	while(it.hasNext()) {
  		User user = it.next();
  		name = user.getName();
  		birthDay = user.getBirthdate();
  		gender = user.getGender();
 // 		relation = user.getRelation();
 // 		languages = user.getLanguages();
  		email = user.getEmail();
 // 		mobile = user.getMobile();
  		workName = user.getWork();
  	}
  	if(request.getParameter("Modify") != null) {
  		User user = new User();
  		user.setName(request.getParameter("Name"));
  		user.setBirthdate(request.getParameter("birthDate"));
  		user.setGender(request.getParameter("Gender"));
  //		user.setRelation(request.getParameter("relation"));
  //		user.setLanguages(request.getParameter("languages"));
  		user.setEmail(request.getParameter("email"));
  //		user.setMobile(request.getParameter("mobile"));
  		user.setWork(request.getParameter("workName"));
  	}
  %>

  <fieldset>
    <legend>About</legend>
    <label>Name:</label>
    <input name="Name" type="text" size="20" maxlength="20" value = <%= name %>/> <br />
    <label>Birthday:</label>
    <input name="birthDay" type="text" size="20" maxlength="20" value = <%= birthDay %>/> <br />
   	<label>Gender:</label>
    <input name="Gender" type="text" size="20" maxlength="20" value = <%= gender %>/> <br />
    <label>Relationship Status:</label>
    <input name="relation" type="text" size="20" maxlength="20" value = <%= relation %>/> <br />
    <label>Languages:</label>
    <input name="languages" type="text" size="20" maxlength="20" value = <%= languages %>/> <br />
  </fieldset>
  <fieldset>
  	<legend>Contact Information</legend>
    <label>Email:</label>
    <input name="email" type="text" size="20" maxlength="20" value = <%= email %>/> <br />
    <label>Mobile number:</label>
    <input name="mobile" type="text" size="20" maxlength="20" value = <%= mobile %>/> <br />
  </fieldset>

  
  <fieldset>
    <legend>Work</legend>
    <label>Name:</label>
    <input name="workName" type="text" size="20" maxlength="20" value = <%= workName %>/>    
  </fieldset>

  
   <form action="myPage.jsp" method="post">
   		<input name="Modify" type="submit" value="Modify" />
   </form>

  <!-- end .sidebar1 --></div>
  <div class="content"></div>

  <!-- end .container --></div>
</body>
</html>